Class sjl.MultiMap
All Packages Class Hierarchy This Package Previous Next Index
Class sjl.MultiMap
java.lang.Object
|
+----sjl.MultiMap
- public class MultiMap
- extends Object
- implements AssociativeContainer, ReversibleContainer
MultiMap
is a kind of associative container that supports
equal keys (possible contains multiple copies of the same key value)
and provides for fast retrieval of another object based on the keys.
Copyright © 1996 Finn Bock
-
MultiMap(InputIterator, InputIterator, Predicate2)
- Construct a map and initialize it with the elements in the
range
[first,last)
.
-
MultiMap(MultiMap)
- Construct a map and initialize it with the contents of another map.
-
MultiMap(Predicate2)
- Construct an empty map.
-
begin()
- Returns the iterator that represents the beginning of the map.
-
beginGeneric()
- Returns the iterator that represents the beginning of the map as an
untyped iterator.
-
beginRef()
- Returns a reference to the iterator that represents the beginning
of the map.
-
count(Object)
- Returns the number of element with a key equal to value.
-
empty()
- Returns
true
if the map does not contain any elements.
-
end()
- Returns the iterator that represents the end of the map.
-
endGeneric()
- Returns the iterator that represents the end of the map as an
untyped iterator.
-
endRef()
- Returns a reference to the iterator that represents the end of the map.
-
equal_range(Object)
- Returns a pair like
Pair(lower_bound(value), upper_bound(value))
.
-
equals(Object)
- Compare the elements in this container with the elements
in another container.
-
erase(Iterator)
- Erase the element pointed to by the iterator.
-
erase(Iterator, Iterator)
- Erase the elements in the range
[first,last)
.
-
erase(Object)
- Erase the elements with key equal to value.
-
find(Object)
- Search the map for an element with a key equal to value.
-
flush()
- Erase all the elements in the container.
-
insert(InputIterator, InputIterator)
- Insert the elements from the range
[first,last)
into
the map.
-
insert(Iterator, Pair)
- Insert an element into the map.
-
insert(Pair)
- Insert an element into the map.
-
lower_bound(Object)
- Returns an iterator pointing to the first element with a key not
less than value.
-
max_size()
- Returns the maximum number of elements allowed in a map.
-
rbegin()
- Returns a copy of the reverse iterator that represents the
beginning (end) of the list.
-
rbeginGeneric()
- Returns a copy of the reverse iterator that represents the
beginning (end) of the list as an untyped Iterator.
-
rend()
- Returns a copy of the iterator that represents the end (beginning)
of the list.
-
rendGeneric()
- Returns a copy of the iterator that represents the end (beginning)
of the list as an untyped Iterator.
-
size()
- Returns the number of elements in the map.
-
upper_bound(Object)
- Returns an iterator pointing to the first element with a key greter
than value.
MultiMap
public MultiMap(Predicate2 predicate)
- Construct an empty map.
- Parameters:
- predicate - Use predicate as the comparison object.
MultiMap
public MultiMap(MultiMap map)
- Construct a map and initialize it with the contents of another map.
- Parameters:
- map - Initialize the new map with the elements of map.
- predicate - Use predicate as the comparison object.
MultiMap
public MultiMap(InputIterator first,
InputIterator last,
Predicate2 predicate)
- Construct a map and initialize it with the elements in the
range
[first,last)
.
- Parameters:
- first - The beginning of the range.
- last - The end of the range.
- predicate - Use predicate as the comparison object.
flush
public void flush()
- Erase all the elements in the container.
equals
public boolean equals(Object container)
- Compare the elements in this container with the elements
in another container.
- Returns:
-
true
is the elements match.
- Overrides:
- equals in class Object
begin
public BidirectionalIterator begin()
- Returns the iterator that represents the beginning of the map.
beginRef
public BidirectionalIterator beginRef()
- Returns a reference to the iterator that represents the beginning
of the map.
end
public BidirectionalIterator end()
- Returns the iterator that represents the end of the map.
endRef
public BidirectionalIterator endRef()
- Returns a reference to the iterator that represents the end of the map.
beginGeneric
public ForwardIterator beginGeneric()
- Returns the iterator that represents the beginning of the map as an
untyped iterator.
endGeneric
public ForwardIterator endGeneric()
- Returns the iterator that represents the end of the map as an
untyped iterator.
rbegin
public ReverseBidirectionalIterator rbegin()
- Returns a copy of the reverse iterator that represents the
beginning (end) of the list.
rend
public ReverseBidirectionalIterator rend()
- Returns a copy of the iterator that represents the end (beginning)
of the list.
rbeginGeneric
public Iterator rbeginGeneric()
- Returns a copy of the reverse iterator that represents the
beginning (end) of the list as an untyped Iterator.
rendGeneric
public Iterator rendGeneric()
- Returns a copy of the iterator that represents the end (beginning)
of the list as an untyped Iterator.
size
public int size()
- Returns the number of elements in the map.
max_size
public int max_size()
- Returns the maximum number of elements allowed in a map.
empty
public boolean empty()
- Returns
true
if the map does not contain any elements.
insert
public RBtreeIterator insert(Pair value)
- Insert an element into the map.
- Parameters:
- value - The element to insert.
- Returns:
- An iterator that point to the newly inserted element
insert
public RBtreeIterator insert(Iterator position,
Pair value)
- Insert an element into the map.
- Parameters:
- position - A hint pointing to where the insert should start to
search. If the hint is correct, and the value is inserted
right after position, the time is amortized constant.
- value - The element to insert.
- Returns:
- The an iterator that point to the element with a key equal
to the key of value
insert
public void insert(InputIterator first,
InputIterator last)
- Insert the elements from the range
[first,last)
into
the map.
- Parameters:
- first - The beginning of the range.
- last - The end of the range.
erase
public void erase(Iterator position)
- Erase the element pointed to by the iterator.
- Parameters:
- position - Points to the element to be removed.
erase
public int erase(Object value)
- Erase the elements with key equal to value.
- Returns:
- The number of element erased.
erase
public void erase(Iterator first,
Iterator last)
- Erase the elements in the range
[first,last)
.
- Parameters:
- first - The beginning of the range.
- last - The end of the range.
find
public ForwardIterator find(Object value)
- Search the map for an element with a key equal to value.
- Parameters:
- value - The key to search for.
- Returns:
- An Iterator pointing to the element with a key equal to value,
or end() if such an element is not found.
count
public int count(Object value)
- Returns the number of element with a key equal to value.
lower_bound
public RBtreeIterator lower_bound(Object value)
- Returns an iterator pointing to the first element with a key not
less than value.
upper_bound
public RBtreeIterator upper_bound(Object value)
- Returns an iterator pointing to the first element with a key greter
than value.
equal_range
public Pair equal_range(Object value)
- Returns a pair like
Pair(lower_bound(value), upper_bound(value))
.
All Packages Class Hierarchy This Package Previous Next Index